home *** CD-ROM | disk | FTP | other *** search
Text File | 1994-07-26 | 1.3 KB | 52 lines | [TEXT/PJMM] |
- {******************************}
- {********* SAT Collision ][ **********}
- {******************************}
-
- {A more advanced version of SAT Collision, demonstrating the use of callback routines}
- {(hit task) for collision handling. What has happened is that the apples switch between}
- {good and bad, and we are not supposed to eat it when it's bad.}
-
- program SATcollisionII;
-
- uses
- SAT, sMrEgghead, sApple;
-
- var
- ignoreSp: SpritePtr;
- l: longint;
- ignore: integer;
- p: Point;
- begin
- {Standard Inits are done by Think Pascal.}
-
- ConfigureSAT(true, kVPositionSort, kBackwardCollision, 32);
- InitSAT(128, 129, 512, 322);
-
- InitMrEgghead;
- InitApple;
-
- ShowWindow(gSAT.wind);
- SelectWindow(gSAT.wind);
- PeekOffscreen;
-
- GetMouse(p);
- ignoreSp := NewSprite(0, p.h, p.v, @SetupMrEgghead);
- ignoreSp := NewSprite(0, 0, Rand(gSAT.offSizeV - 32), @SetupApple);
-
- HideCursor;
-
- {Get two channels if possible, since we use fairy long sounds.}
- ignore := SATSoundInitChannels(2);
-
- repeat
- l := TickCount;
- RunSAT(true);
- {Start a new sprite once in a while.}
- if Rand(40) = 1 then
- ignoreSp := NewSprite(0, 0, Rand(gSAT.offSizeV - 32), @SetupApple);
- while l > TickCount - 2 do {Maximize speed to 30 fps}
- ;
- until Button;
- ShowCursor;
- SATSoundShutUp; {Always make sure the sound channel is de-allocated!}
- end.